const seq = require('../db_connect'),
      { STRING, INT, TEXT, DECIMAL } = require('../../configs/db_type');

const RecomCourse = seq.define('recom_course', {
  cid: {
    comment: 'Course id',
    type: INT,
    allowNull: false,
    unique: true
  }, 
  href: {
    comment: 'Course detail page link',
    type: STRING,
    allowNull: false,
  }, 
  mainTitle: {
    comment: 'Page category title',
    type: STRING,
    allowNull: false,
  }, 
  title: {
    comment: 'Course name',
    type: STRING,
    allowNull: false,
  }, 
  posterUrl: {
    comment: 'course poster image',
    type: STRING,
    allowNull: false,
  }, 
  description: {
    comment: 'course description',
    type: STRING,
    allowNull: false,
  },
  teacherName: {
    comment: 'Teacher name',
    type: STRING,
    allowNull: false,
  },
  studentCount: {
    comment: 'count of students who purchased this course',
    type: INT,
    allowNull: false,
  },
  price: {
    comment: 'Course price',
    type: DECIMAL,
    allowNull: false,
  },
  posterKey: {
    comment: 'Qiniu course image name',
    type: STRING,
    allowNull: false,
  },
  teacherImgKey: {
    comment: 'Qiniu teacher image name',
    type: STRING,
    allowNull: false,
  },
  status: {
    comment: 'recoment_course_status', //控制是否显示
    type: INT,
    defaultValue: 1,
    allowNull: false //设初始值要同时设置非空
  }

});

module.exports = RecomCourse;